package com.zhonghui.modules.mapper;

import com.eshop.mapper.CoreMapper;

import com.zhonghui.modules.domain.StoreProductRelation;
import com.zhonghui.modules.vo.StoreProductRelationQueryVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;

public interface ProductRelationMapper extends CoreMapper<StoreProductRelation> {

    @Select("select B.id pid,A.type as category,B.store_name as storeName,B.price,B.is_integral as isIntegral," +
            "B.ot_price as otPrice,B.sales,B.image,B.is_show as isShow,B.integral as integral from " +
            "store_product_relation A left join store_product B on A.product_id = B.id where A.type=#{type} and A.uid=#{uid}" +
            " and A.is_del = 0,B.is_del = 0 order by A.create_time desc")
    List<StoreProductRelationQueryVo> select(Page page, @Param("uid")Long uid,@Param("type")String type);
}
